<template>
  <div class="home">
    <!-- 轮播 -->
    <van-swipe
      class="my-swipe"
      :autoplay="3000"
      indicator-color="white"
    >
      <van-swipe-item
        v-for="item in lunbolist"
        :key="item.id"
      >
        <img :src="item.img">
      </van-swipe-item>
    </van-swipe>
    <van-grid :column-num="3">
      <van-grid-item
        v-for="grids in gridslist"
        :key="grids.id"
        :icon="grids.src"
        :text="grids.title"
        :to="grids.to"
      />
    </van-grid>
  </div>
</template>

<script>
// import axios from 'axios'
// import { Toast } from 'vant'
export default {
  components: {
  },
  data() {
    return {
      lunbolist: [],
      gridslist: []
    }
  },
  created() {
    this.getLunbo()
    this.getGrids()
  },
  methods: {
    async getLunbo() {
      const res = await this.$http.getLunbo()
      this.lunbolist = res.message
    },
    async getGrids() {
      const res = await this.$http.getGrids()
      this.gridslist = res.message
    }
  }
}
</script>
<style lang="scss">
.home {
  .my-swipe {
    height: 200px;
    background: red;
    img {
      width: 100%;
      height: 100%;
    }
  }
  .van-grid-item__icon {
    font-size: 40px;
  }
}
</style>
